package question.solution26;

import question.SolutionTemplate;

import java.util.HashMap;
import java.util.Map;

public class Solution26 implements SolutionTemplate {

    public int removeDuplicates(int[] nums) {
        if(nums.length <= 1){
            return nums.length;
        }
        int pl=0;
        int pr=1;
        int compValue = nums[pl];
        while(pr<nums.length){
            if(nums[pr] == compValue){
                pr++;
            }else{
                nums[pl+1] = nums[pr];
                compValue = nums[pr];
                pl++;
                pr++;
            }
        }
        return pl+1;
    }


    public void test() {
        int[] nums = {0,0,1,1,1,2,2,3,3,4};
        int result = removeDuplicates(nums);
        return;
    }
}
